package com.briup.MR.Combiner;

import org.apache.hadoop.io.Writable;

import java.io.DataInput;
import java.io.DataOutput;
import java.io.IOException;

/*
map->
key       value
year      SumValue(temp,1)
1992      SumValue(23,1)
 */
public class SumValue implements Writable {
    private Double temp;
    private int num;
    public SumValue() {
    }

    public SumValue(Double temp, int num) {
        this.temp = temp;
        this.num = num;
    }

    public Double getTemp() {
        return temp;
    }

    public void setTemp(Double temp) {
        this.temp = temp;
    }

    public int getNum() {
        return num;
    }

    public void setNum(int num) {
        this.num = num;
    }

    @Override
    public String toString() {
        return "SumValue{" +
                "temp=" + temp +
                ", num=" + num +
                '}';
    }

    public void write(DataOutput dataOutput) throws IOException {
        dataOutput.writeDouble(temp);
        dataOutput.writeInt(num);
    }

    public void readFields(DataInput dataInput) throws IOException {
        this.temp = dataInput.readDouble();
        this.num =dataInput.readInt();
    }
}
